<?php
class MyModel extends Model{
	public  $myuser;
	public  $mynick;
	public  $mypass;
	public  $myphone;
	public  $myid;
	public  $mysex;
	public  $mymobile;
	public  $mystatus;
	public $all=array();

	function __construct($id=null){
		if ($id){
			$this->myid=$id;
		}		else{
			$info=getInf();
			$this->myid=empty($info["USER_ID"])?0:$info["USER_ID"];
		}
		parent::__construct();
	}
	
	function init(){
		$this->OpenDB();
		$sql="select * from @#__user where user_id={$this->myid}";
		$rs=$this->db->get_one($sql);
		if ($rs){
			$this->myuser=$rs['user_name'];
			$this->mynick=$rs['user_nick'];
			$this->mypass=$rs['user_pass'];
			$this->myphone=$rs['user_phone'];
			$this->mysex=$rs['user_sex'];
			$this->mymobile=$rs['user_mobile'];
			$this->mystatus=$rs['user_status'];
			$this->all=$rs;
		}else{
			$this->myuser=$rs['user_name']='null';
			$this->mynick=$rs['user_nick']='游客';
			$this->mypass=$rs['user_pass']='';
			$this->myphone=$rs['user_phone']='135';
			$this->mysex=$rs['user_sex']='3';
			$this->mymobile=$rs['user_mobile']='Null';
			$this->mystatus=$rs['user_status']='0'; 
			$this->all=$rs;
		}
	}
}